package com.xuxin.baby.adapter;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.xuxin.baby.R;
import com.xuxin.baby.glide.GlideApp;

import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by xu_xin
 * Created on 2020.08.04 0004
 * 功能列表
 */
public class UserExtendAdapter extends BaseQuickAdapter<String, BaseViewHolder> {

    public UserExtendAdapter() {
        super(R.layout.item_user_extend);
        List<String> list = new ArrayList<>();
        list.add("我的课程");
        list.add("我的宝宝");
        list.add("我的购物车");
        list.add("我的订单");
        list.add("我的报告");
        list.add("邀请码");
        list.add("平台客服");
        list.add("设置");
        setNewInstance(list);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder holder, String item) {
        ImageView item_user_function_image = holder.getView(R.id.item_user_extend_image);
        holder.setText(R.id.item_user_extend_name, item);
        switch (holder.getAdapterPosition()) {
            case 0:
                holder.setText(R.id.item_user_extend_desc, "已购买过的视频");
                GlideApp.with(getContext()).load(R.mipmap.img_user_course).centerCrop().into(item_user_function_image);
                break;
            case 1:
                holder.setText(R.id.item_user_extend_desc, "查看编辑宝宝信息");
                GlideApp.with(getContext()).load(R.mipmap.img_user_child).centerCrop().into(item_user_function_image);
                break;
            case 2:
                holder.setText(R.id.item_user_extend_desc, "需要购买的课程");
                GlideApp.with(getContext()).load(R.mipmap.img_user_cart).centerCrop().into(item_user_function_image);
                break;
            case 3:
                holder.setText(R.id.item_user_extend_desc, "购买订单查看");
                GlideApp.with(getContext()).load(R.mipmap.img_user_order).centerCrop().into(item_user_function_image);
                break;
            case 4:
                holder.setText(R.id.item_user_extend_desc, "测评结果报告查看");
                GlideApp.with(getContext()).load(R.mipmap.img_user_report).centerCrop().into(item_user_function_image);
                break;
            case 5:
                holder.setText(R.id.item_user_extend_desc, "平台邀请码");
                GlideApp.with(getContext()).load(R.mipmap.img_user_code).centerCrop().into(item_user_function_image);
                break;
            case 6:
                holder.setText(R.id.item_user_extend_desc, "联系平台客服");
                GlideApp.with(getContext()).load(R.mipmap.img_user_kefu).centerCrop().into(item_user_function_image);
                break;
            case 7:
                holder.setText(R.id.item_user_extend_desc, "");
                GlideApp.with(getContext()).load(R.mipmap.img_user_setting).centerCrop().into(item_user_function_image);
                break;
        }
    }
}